home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
UTIL
/
SYS
/
RPCBOOT
/
!RPCBootEd
/
Source
(
.txt
)
< prev
Wrap
RISC OS BBC BASIC V Source
|
1995-03-08
|
36KB
|
1,604 lines
><RPCBootEd$Dir>.Source
This application is FreeWare. (c) 1995 Dick Alstein
appl$="RPCBootEd"
"applversion$="1.00 (8-Mar-95)"
error
quit%=
)mask%=1+(1<<4)+(1<<5)+(1<<11)+(1<<12)
"Wimp_Poll",mask%,blk%
reason%
reason%
1 :
redraw(blk%!0)
2 :
"Wimp_OpenWindow",,blk%
blk%!0
!
winhdl%(0),winhdl%(1)
.
"Wimp_GetPointerInfo",,ptrinfo%
ptrinfo%!8=1
Adjust-close
(
"Filer_OpenDir "+seqdir$
-1)
)
"Wimp_CloseWindow",,blk%
'
"Wimp_CloseWindow",,blk%
6 :
mouseclick(blk%!0,blk%!4,blk%!8,blk%!12,blk%!16)
7 :
appl_move
8 :
key(blk%!0,blk%!4,blk%!24)
9 :
menuselect(blk%)
17,18 :
receive(blk%!4,blk%!8,blk%!16)
quit%
buf%,w%,i%
errblk% &100
"Wimp_Initialise",200,&4B534154,appl$
osversion%,thistask%
error :
blk% &600
indsize%=&600
indir% indsize%
indirend%=indir%+indsize%
ptrinfo% 20
dragblk% 60
scrapblk% 256
scrapblk2% 256
4)ApplDir$=
readvarval("RPCBootEd$Dir")
ApplPath$="RPCBootEdRes:"
msg_init
bariconname% 16
scrapblk%!0=-1
9!scrapblk%!4=0 : scrapblk%!8=0
:%scrapblk%!12=68 : scrapblk%!16=68
scrapblk%!20=&7000311A
scrapblk%!24=bariconname%
scrapblk%!28=1
scrapblk%!32=16
? $(bariconname%)="frpcbooted"
"Wimp_CreateIcon",,scrapblk%
baricon%
winhdl%(1)
wintitle%(1)
maxapps%=256
"Wimp_OpenTemplate",,ApplPath$+"Templates"
E"infowin%=
loadtemplate("Info")
F%$(blk%!(92+7*32+20))=applversion$
G'winhdl%(0)=
loadtemplate("BootSeq")
icon0xmin%=blk%!(92+0*32+0)
icon0xmax%=blk%!(92+0*32+8)
icon0ymin%=blk%!(92+0*32+4)
icon1xmin%=blk%!(92+1*32+0)
icon1xmax%=blk%!(92+1*32+8)
icon2xmin%=blk%!(92+2*32+0)
icon2xmax%=blk%!(92+2*32+8)
itemheight%=80
wintitle%(0)=blk%!76
i% (blk%!84)
wintitle%(1)=i%
blk%!76=wintitle%(1)
"Wimp_CreateWindow",,blk%+4
winhdl%(1)
U($(wintitle%(0))=
msg_lookup0("BSEQ")
V)$(wintitle%(1))=
msg_lookup0("DBSEQ")
W(dialogwin%=
loadtemplate("Dialogue")
dial_msg%=blk%!(92+20)
Y<dial_buttoncol%=(blk%!(92+1*32+16))
((1<<2)+(&FF<<24))
dial_text%(3)
[#dial_text%(1)=blk%!(92+1*32+20)
\#dial_text%(2)=blk%!(92+2*32+20)
]#dial_text%(3)=blk%!(92+3*32+20)
"Wimp_CloseTemplate"
nractions%=8
action%(nractions%)
i%=0
nractions%
buf% 16
action%(i%)=buf%
$(action%(0))="Run"
$(action%(1))="Boot"
$(action%(2))="Filer_Run"
$(action%(3))="Filer_Boot"
i!$(action%(4))="Filer_OpenDir"
$(action%(5))="IconSprites"
$(action%(6))="ToolSprites"
$(action%(7))="RMLoad"
$(action%(8))="AddApp"
Action$(nractions%+1)
i%=0
nractions%
p) Action$(i%)=
upcase($(action%(i%)))
nrapps%(1)
nrapps%(0)=0
nrapps%(1)=0
u8applblksize%=0 :
size of a block for item data
v#applblksize%+=256 :
pathname
w#applblksize%+=12 :
leafname
applblksize%+=4 :
type
y4applblksize%+=16 :
name of sprite to display
z!applblksize%+=4 :
action
{,applblksize%+=4 :
"disabled" switch
|%applblksize%+=256 :
parameters
appl%(1,maxapps%) :
pointers to item data blocks
heap_init
initmenus
readscreenvars
display%(1) :
0 -> Name + Action, 1 -> Full info
winxmin%(1),winymin%(1),winxmax%(1),winymax%(1)
prevclicktime%=0
prevclickline%=-1
choices_load
changed%(1)
changed%(0)=
changed%(1)=
8shutdown_ok%=
allow shutdown with changes made?
seqfname$(1)
seqfname$(0)="PreDesktop"
seqfname$(1)="Desktop"
starttag$="|Start "+appl$
endtag$="|End"
determine boot directory
"OS_Byte",161,5
,,fsnum%
"OS_FSControl",33,fsnum%,scrapblk%,&100
,,fs$
drivenum%=4
2$(scrapblk2%)=fs$+"::"+
(drivenum%)+".$.!Boot"
"OS_FSControl",37,scrapblk2%,scrapblk%,0,0,&100
bootdir$=
str(scrapblk%)
$seqdir$=bootdir$+".Choices.Boot"
workdir$=seqdir$+"."+appl$
"backupdir$=workdir$+".Backups"
"origdir$=workdir$+".Originals"
direxists(bootdir$)
5 dummy%=
errbox(
msg_lookup1("CFBD",bootdir$),2)
i%=0
fileexists(
seqfname(i%))
< dummy%=
errbox(
msg_lookup1("CFBS",
seqfname(i%)),2)
try to read the sequences
setinstalled(
direxists(workdir$))
installed%
seq_loadall
backupexists%(1)
i%=0
A backupexists%(i%)=
fileexists(backupdir$+"."+seqfname$(i%))
redraw(handle%)
w%,more%,top%,linenr%,lastline%
handle%=winhdl%(0)
w%=0
w%=1
blk%!0=handle%
"Wimp_RedrawWindow",,blk%
more%
#top%=blk%!16-blk%!24+icon0ymin%
more%
* linenr%=(top%-blk%!40)
itemheight%
, lastline%=(top%-blk%!32)
itemheight%
linenr%<=lastline%
0
(linenr%<nrapps%(w%))
(linenr%>=0)
)
print item data for this line
1. icon + leafname
b%=appl%(w%,linenr%)
# scrapblk%!0=icon0xmin%+12
scrapblk%!8=icon0xmax%
7 scrapblk%!12=icon0ymin%-(itemheight%*linenr%)
0 scrapblk%!4=(scrapblk%!12)-itemheight%
b%!292
" scrapblk%!16=&13400133
" scrapblk%!16=&17000133
scrapblk%!20=b%+256
scrapblk%!24=b%+272
scrapblk%!28=12
&
$(b%+272)="Sapplication"
E
check if sprite-less application has been seen by Filer
%
sprexists($(b%+256))
! $(b%+272)=$(b%+256)
'
"Wimp_PlotIcon",,scrapblk%
2. action
scrapblk%!0=icon1xmin%
scrapblk%!8=icon1xmax%
b%!292
" scrapblk%!16=&13000131
" scrapblk%!16=&17000131
& scrapblk%!20=action%(b%!288)
scrapblk%!28=-1
scrapblk%!32=16
'
"Wimp_PlotIcon",,scrapblk%
3. arguments
display%(w%)=1
" scrapblk%!0=icon2xmin%
" scrapblk%!8=icon2xmax%
b%!292
$ scrapblk%!16=&13000131
$ scrapblk%!16=&17000131
scrapblk%!20=b%+296
scrapblk%!28=-1
scrapblk%!32=256
)
"Wimp_PlotIcon",,scrapblk%
linenr%+=1
"Wimp_GetRectangle",,blk%
more%
coordtolinenr(w%,y%)
yc%,l%
scrapblk%!0=winhdl%(w%)
"Wimp_GetWindowState",,scrapblk%
/yc%=scrapblk%!16-scrapblk%!24+icon0ymin%-y%
yc%<0
l%=-1
l%=yc%
itemheight%
l%>nrapps%(w%)
l%=nrapps%(w%)
coordtofieldnr(w%,x%)
scrapblk%!0=winhdl%(w%)
"Wimp_GetWindowState",,scrapblk%
x%-=scrapblk%!4-scrapblk%!20
x%<icon1xmin%
f%=0
x%<icon2xmin%
f%=1
f%=2
appl_add(w%,name$,action%,args$,off%,nr%)
b%,i%,spr$
nrapps%(w%)=maxapps%
dialogue(0)
nr%<0
nr%=0
nr%<nrapps%(w%)
3
inserting in sequence - shift other items
#
i%=nrapps%(w%)
nr%
% appl%(w%,i%+1)=appl%(w%,i%)
nr%=nrapps%(w%)
b%=
heap_get(applblksize%)
appl%(w%,nr%)=b%
$(b%)=name$
# $(b%+256)=
leafname(name$)
b%!268=
objtype(name$)
appl_setsprite(w%,nr%)
action%=-1
'+
attach default action to new item
type%
&1000 : b%!288=4
&2000
(w%=1)
b%!288=3
b%!288=0
&FF9 : b%!288=5
&FFA : b%!288=7
: b%!288=0
3
b%!288=action%
b%!292=off%
$(b%+296)=args$
nrapps%(w%)+=1
seq_setextent(w%)
seq_setchanged(w%,
redrawfromline(w%,nr%)
appl_setsprite(w%,nr%)
data%,spr$
data%=appl%(w%,nr%)
data%!268
spr$="file_???"
spr$="file_xxx"
&1000
spr$="directory"
&2000
K$
sprexists($(data%+256))
spr$=$(data%+256)
M
spr$="application"
O
Q" spr$="file_"+
~(data%!268)
sprexists(spr$)
spr$="file_xxx"
T
$(data%+272)="S"+spr$
appl_del(w%,nr%)
heap_release(appl%(w%,nr%))
i%=nr%
(nrapps%(w%)-1)
]! appl%(w%,i%)=appl%(w%,i%+1)
nrapps%(w%)-=1
redrawfromline(w%,nr%)
seq_setchanged(w%,
seq_setextent(w%)
appl_move
w%,linenr%,a%,i%
dragasprite%
"DragASprite_Stop"
"Wimp_GetPointerInfo",,ptrinfo%
i w%=-1
ptrinfo%!12=winhdl%(0)
w%=0
ptrinfo%!12=winhdl%(1)
w%=1
w%<>-1
m+ linenr%=
coordtolinenr(w%,ptrinfo%!4)
linenr%<0
linenr%=0
o* a%=appl%(dragfromwin%,dragfromline%)
w%=dragfromwin%
q6
linenr%>=nrapps%(w%)
linenr%=nrapps%(w%)-1
r!
dragfromline%>linenr%
move down
t/
i%=(dragfromline%-1)
linenr%
u' appl%(w%,i%+1)=appl%(w%,i%)
appl%(w%,linenr%)=a%
x%
redrawfromline(w%,linenr%)
y
z!
dragfromline%<linenr%
move up
|*
i%=dragfromline%
(linenr%-1)
}' appl%(w%,i%)=appl%(w%,i%+1)
appl%(w%,linenr%)=a%
+
redrawfromline(w%,dragfromline%)
$
(dragfromline%<>linenr%)
seq_setchanged(w%,
move to other window
nrapps%(w%)<maxapps%
=
appl_add(w%,$(a%),a%!288,$(a%+296),a%!292,linenr%)
/
appl_del(dragfromwin%,dragfromline%)
openwindow(0,3)
openwindow(1,3)
redrawline(w%,linenr%)
xmin%,ymin%,xmax%,ymax%
xmin%=icon0xmin%+12
xmax%=icon2xmax%
*ymax%=icon0ymin%-(itemheight%*linenr%)
ymin%=ymax%-itemheight%
"Wimp_ForceRedraw",winhdl%(w%),xmin%,ymin%,xmax%,ymax%
redrawfromline(w%,linenr%)
xmin%,ymin%,xmax%,ymax%
xmin%=icon0xmin%+12
xmax%=icon2xmax%
*ymax%=icon0ymin%-(itemheight%*linenr%)
ymin%=-10000
"Wimp_ForceRedraw",winhdl%(w%),xmin%,ymin%,xmax%,ymax%
seq_clear(w%)
nrapps%(w%)>0
appl_del(w%,nrapps%(w%)-1)
seq_setchanged(w%,
seq_loadall
"Hourglass_On"
seq_load(0,
seqfname(0))
seq_load(1,
seqfname(1))
"Hourglass_Off"
seq_load(w%,fn$)
p%,in$,cmd$,file$,arg$,act%,reading%,disabled%
(fn$)
error :
reading%=
in$=
- reading%=(
(starttag$))=starttag$)
reading%
reading%
in$=
p%=
in$,"|")
disabled%=(p%=1)
p%>0
. reading%=(
(endtag$))<>endtag$)
disabled%
in$=
in$,p%+1)
p%=
in$," ")
+ cmd$=
upcase(
trimleft(
in$,p%-1)))
! in$=
trimleft(
in$,p%+1))
p%=
in$," ")
file$=
in$,p%-1)
" arg$=
trimleft(
in$,p%+1))
$
(cmd$<>"")
(file$<>"")
act%=0
7
(act%<=nractions%)
(cmd$<>Action$(act%))
act%+=1
(act%<=nractions%)
act%
5
upcase(
leafname(file$))="!BOOT"
act%=1
' file$=
dirname(file$)
<
upcase(
leafname(file$)),8)="!SPRITES"
8
leafname(
dirname(file$)),1)="!"
act%=1
) file$=
dirname(file$)
A
appl_add(w%,file$,act%,arg$,disabled%,nrapps%(w%)+1)
reading%)
seq_setchanged(w%,
openwindow(w%,3)
seq_save(w%)
fn$,bfn$,tfn$,i%,data%
error :
seqfname(w%)
tfn$=seqdir$+".temp"
tfn$
copy parts that were written by other apps
#G%)
(starttag$))=starttag$))
#F%,in$
in$=
writing our data for the first time (no start tag found), so
add a blank line
#F%,""
#G%)
(endtag$))=endtag$))
skip our old stuff
in$=
write a header
#F%,starttag$+" "+applversion$
#F%,"| -------------------"
#F%,"| "
#F%,"| "+appl$
#F%,"| "
#F%,"| -------------------"
#F%,"| "
#F%,"| Sequence saved at "+
#F%,"| "
save our new data
nrapps%(w%)>0
i%=0
nrapps%(w%)-1
data%=appl%(w%,i%)
data%!292
#F%,"|";
data%!268=&2000
data%!288
0
fileexists($(data%)+".!Boot")
.
#F%,"Run "+$(data%)+".!Boot";
9
#F%,"IconSprites "+$(data%)+".!Sprites";
6
#F%,$(action%(data%!288))+" "+$(data%);
2
#F%,$(action%(data%!288))+" "+$(data%);
#F%," "+$(data%+296)
#F%,endtag$
copy what is after our stuff
in$=
#F%,in$
"OS_File",18,tfn$,
objtype(fn$)
fileexists(fn$)
.' bfn$=backupdir$+"."+seqfname$(w%)
/1 copyopts$=" A ~C ~D F ~N ~P ~Q ~R ~S ~T ~V"
"Copy "+fn$+" "+bfn$+" "+copyopts$
backupexists%(w%)=
"Delete "+fn$
"Rename "+tfn$+" "+fn$
seq_setchanged(w%,
seq_setchanged(w%,newval%)
changed%(w%)
newval%
t$=$(wintitle%(w%))
changed%(w%)
=% $(wintitle%(w%))=
(t$)-2)
? $(wintitle%(w%))=t$+" *"
A! changed%(w%)=
changed%(w%)
blk%!0=winhdl%(w%)
"Wimp_GetWindowState",,blk%
(blk%!32
(1<<16))
EH
"Wimp_ForceRedraw",-1,blk%!4,(blk%!16)+4,blk%!12,(blk%!16)+36
seq_setextent(w%)
lines%
lines%=nrapps%(w%)+1
lines%<2
lines%=2
scrapblk%!0=0
O/scrapblk%!4=icon0ymin%-itemheight%*lines%-8
display%(w%)=1
scrapblk%!8=icon2xmax%-1
scrapblk%!8=icon1xmax%-1
scrapblk%!12=0
"Wimp_SetExtent",winhdl%(w%),scrapblk%
scrapblk%!0=winhdl%(w%)
SYS "Wimp_GetWindowState",,scrapblk%
IF (scrapblk%!32 AND (1<<16)) THEN SYS "Wimp_OpenWindow",,scrapblk%
install_do
"CDir "+workdir$
"CDir "+backupdir$
"CDir "+origdir$
`0copyopts$=" A ~C ~D ~F ~N ~P ~Q ~R ~S ~T ~V"
"Copy "+
seqfname(0)+" "+origdir$+"."+seqfname$(0)+" "+copyopts$
"Copy "+
seqfname(1)+" "+origdir$+"."+seqfname$(1)+" "+copyopts$
c/copyopts$=" A ~C ~D F ~N ~P ~Q ~R ~S ~T ~V"
"Copy "+ApplPath$+seqfname$(0)+" "+
seqfname(0)+" "+copyopts$
"Copy "+ApplPath$+seqfname$(1)+" "+
seqfname(1)+" "+copyopts$
setinstalled(
openwindow(0,1)
openwindow(1,1)
install_undo
closewindow(winhdl%(0))
closewindow(winhdl%(1))
seq_clear(0)
seq_clear(1)
p/copyopts$=" A ~C ~D F ~N ~P ~Q ~R ~S ~T ~V"
"Copy "+origdir$+"."+seqfname$(0)+" "+
seqfname(0)+" "+copyopts$
"Copy "+origdir$+"."+seqfname$(1)+" "+
seqfname(1)+" "+copyopts$
wipeopts$=" ~C F R ~V"
"Wipe "+workdir$+wipeopts$
setinstalled(
dirname(F$)
p%,q%
F$,"$")+2
F$,".",p%)
q% > 0
p%=q%+1
q%=0
F$,p%-2)
msg_exit
"Wimp_CloseDown"
errbox(err$,boxes%)
errblk%!0=0
$(errblk%+4)=err$+
"Wimp_ReportError",errblk%,boxes%,appl$
,click%
=(click%=1)
error
"Wimp_CloseDown" :
errbox(
$+" (line "+
)+")",3)
direxists(f$)
type%,flags%
type%=0
(f$)>0
"XOS_File",17,f$
type%;flags%
=(type%=2)
((flags%
1)=0)
fileexists(f$)
type%,flags%
type%=0
(f$)>0
"XOS_File",17,f$
type%;flags%
=(type%=1)
((flags%
1)=0)
seqfname(i%)
=seqdir$+"."+seqfname$(i%)
key(window%,icon%,key%)
"Wimp_ProcessKey",key%
leafname(f$)
p%,q%
p%=q%+1
q%=
f$,".",p%)
q%=0
f$,p%)
--- split name of root directory from pathname ---
striproot(f$)
p%,q%
f$,"$")
q%>0
p%=q%
q%=
f$,"$",p%+1)
f$,p%)
loadtemplate(name$)
handle%
"Wimp_CloseTemplate" :
error
"Wimp_LoadTemplate",,blk%+4,indir%,indirend%,-1,name$,0
,,indir%
"Wimp_CreateWindow",,blk%+4
handle%
=handle%
mouseclick(xpos%,ypos%,button%,wndw%,icon%)
w%,linenr%,field%,data%,a%
wndw%
button%
installed%
&
closewindow(winhdl%(0))
&
closewindow(winhdl%(1))
installed%
openwindow(0,1)
openwindow(1,1)
dialogue(1)
+
showmenu(blk%,mainmenu%,-1,-1)
winhdl%(0),winhdl%(1)
wndw%=winhdl%(0)
w%=0
w%=1
( linenr%=
coordtolinenr(w%,ypos%)
+
linenr%>=nrapps%(w%)
linenr%=-1
( field%=
coordtofieldnr(w%,xpos%)
.
linenr%>=0
data%=appl%(w%,linenr%)
button%
2 :
menu button
/
showmenu(blk%,seqmenu%,w%,linenr%)
)
(linenr%>=0)
(field%=1)
'
adjust button on action
a%=data%!288
a%=0
a%=nractions%
a%-=1
-
validaction(a%,w%,data%!268)
a%<>data%!288
data%!288=a%
'
redrawline(w%,linenr%)
%
seq_setchanged(w%,
)
(linenr%>=0)
(field%=0)
*
adjust button on item name
% data%!292=
(data%!292)
%
redrawline(w%,linenr%)
#
seq_setchanged(w%,
)
(linenr%>=0)
(field%=0)
*
select button on item name
B
-prevclicktime%<50)
(linenr%=prevclickline%)
'
openparent(w%,linenr%)
prevclicktime%=
$ prevclickline%=linenr%
)
(linenr%>=0)
(field%=1)
'
select button on action
a%=data%!288
!
a%=nractions%
a%=0
a%+=1
-
validaction(a%,w%,data%!268)
a%<>data%!288
data%!288=a%
'
redrawline(w%,linenr%)
%
seq_setchanged(w%,
%
4*16 :
drag with select
A
(linenr%>=0)
(linenr%<nrapps%(w%))
(field%=0)
$
startdrag(w%,linenr%)
dialogwin%
"Wimp_CreateMenu",,-1
lastdialogue%
"#
icon%=1
install_do
$%
icon%=1
install_undo
icon%=1
quit%=
icon%=1
))
resume shutdown procedure
shutdown_ok%=
+3
"Wimp_GetCaretPosition",,scrapblk%
scrapblk%!24=&1FC
->
"Wimp_SendMessage",8,scrapblk%,prequitsender%
/
openparent(w%,linenr%)
"Filer_OpenDir "+
dirname($(appl%(w%,linenr%)))
--- open a sequence window
pos%=0 -> at current position
pos%=1 -> at position as read from choices (unless already open)
pos%=2 -> at current position, full width
pos%=3 -> at current position, not on top of stack
openwindow(w%,pos%)
blk%!0=winhdl%(w%)
"Wimp_GetWindowInfo",,blk%
blk%!28=-1
pos%
B#
((blk%!32
(1<<16))=0)
blk%!4=winxmin%(w%)
blk%!8=winymin%(w%)
blk%!12=winxmax%(w%)
blk%!16=winymax%(w%)
G
I( blk%!12=blk%!4+(blk%!52-blk%!44)
K%
((blk%!32
(1<<16))=0)
"Wimp_OpenWindow",,blk%
closewindow(handle%)
scrapblk%!0=handle%
"Wimp_CloseWindow",,scrapblk%
readscreenvars
xeig%,yeig%,xpixels%,ypixels%
"OS_ReadModeVariable",-1,4
,,xeig%
"OS_ReadModeVariable",-1,5
,,yeig%
"OS_ReadModeVariable",-1,11
,,xpixels%
"OS_ReadModeVariable",-1,12
,,ypixels%
unitsppixel_x%=1<<xeig%
unitsppixel_y%=1<<yeig%
]Iscreensize_x%=(xpixels%+1)*unitsppixel_x% :
screen size in OS units
^-screensize_y%=(ypixels%+1)*unitsppixel_y%
readvarval(var$)
len%
"OS_ReadVarVal",var$,scrapblk2%,256,0
,,len%
scrapblk2%?len%=13
=$(scrapblk2%)
receive(sender%,ref%,code%)
w%,ack%,file$,type%,hlp$,linenr%,field%,cmd$
ack%=0
sender% <> thistask%
code%
quit%=
file$=
str(blk%+44)
type%=blk%!40
blk%!20
r#
winhdl%(0),winhdl%(1)
s&
(blk%!20=winhdl%(0))
w%=0
w%=1
xD
appl_add(w%,file$,-1,"",0,
coordtolinenr(w%,blk%!32))
ack%=4
desktop shutdown
}<
(changed%(0)
changed%(1))
shutdown_ok%)
ack%=8
" prequitsender%=sender%
dialogue(4)
desktop save
file%=blk%!20
" cmd$="Run "+ApplDir$+
+
"OS_GBPB",2,file%,cmd$,
(cmd$)
&502
*
request from !Help application
hlp$=""
icon%=blk%!36
blk%!32
icon%=baricon%
- hlp$=
msg_lookup0("HLP_IBAR")
installed%
1 hlp$+=
msg_lookup0("HLP_IBAR1")
1 hlp$+=
msg_lookup0("HLP_IBAR0")
#
winhdl%(0),winhdl%(1)
$
blk%!32=winhdl%(0)
w%=0
- hlp$=
msg_lookup0("HLP_SEQ0")
w%=1
- hlp$=
msg_lookup0("HLP_SEQ1")
0 linenr%=
coordtolinenr(w%,blk%!24)
0 field%=
coordtofieldnr(w%,blk%!20)
B
(icon%<0)
(linenr%>=0)
(linenr%<nrapps%(w%))
field%
;
0 : hlp$+="|M"+
msg_lookup0("HLP_ITEM")
;
1 : hlp$+="|M"+
msg_lookup0("HLP_ACTN")
;
2 : hlp$+="|M"+
msg_lookup0("HLP_ARGS")
hlp$<>""
$(blk%+20)=hlp$
ack%=&503
&400C1
readscreenvars
ack%>0
blk%!0=256
blk%!12=ref%
blk%!16=ack%
-
"Wimp_SendMessage",17,blk%,sender%
sprexists(sp$)
flags%
"XWimp_SpriteOp",&18,,sp$
;flags%
=((flags%
1)=0)
startdrag(w%,linenr%)
b%,spr$,width%
blk%!0=winhdl%(w%)
"Wimp_GetWindowState",,blk%
dragblk%!4=5
dragblk%!8=(blk%!4)+4
Hdragblk%!12=(blk%!16)+icon0ymin%-((linenr%+1)*itemheight%)-(blk%!24)
display%(w%)=0
% width%=icon1xmax%-icon0xmin%-16
% width%=icon2xmax%-icon0xmin%-16
#dragblk%!16=(dragblk%!8)+width%
8dragblk%!20=(dragblk%!12)+itemheight%-unitsppixel_y%
dragblk%!24=0
dragblk%!28=0
dragblk%!32=xpixels%
dragblk%!36=ypixels%
"OS_Byte",161,&1C
,,b% :
read "dragasprite" bit in CMOS RAM (RO3)
dragasprite%=(b%
2)<>0
dragasprite%
"Wimp_GetPointerInfo",,ptrinfo%
dragblk%!8=ptrinfo%!0-100
dragblk%!16=ptrinfo%!0+100
% spr$=$(appl%(w%,linenr%)+272+1)
"DragASprite_Start",&E5,1,spr$,dragblk%+8,dragblk%+24
"Wimp_DragBox",1,dragblk%
dragfromwin%=w%
dragfromline%=linenr%
str(s%)
i%,n$
s%?i% >= 32 : n$+=
(s%?i%) : i%+=1 :
trimleft(s$)
s$,p%,1)=" "
p%+=1
s$,p%)
upcase(s$)
i%=1
a%=
s$,i%,1))
(a%>=97)
(a%<=122)
s$,i%,1)=
(a%-32)
returns type of object
-2 = not found
-1 = untyped file
&000-&FFF = typed file
&1000 = directory
&2000 = application
objtype(name$)
type%,loadaddr%
"OS_File",17,name$
type%,,loadaddr%
type%
type%=-2
(
((loadaddr%>>20)
&FFF)=&FFF
% type%=(loadaddr%>>8)
&FFF
type%=-1
$
leafname(file$),1)="!"
type%=&2000
type%=&1000
=type%
validaction(action%,window%,type%)
valid%
type%
&FF9
( valid%=(action%=5)
(action%=6)
&FFA
( valid%=(action%=0)
(action%=7)
&1000
valid%=(action%=4)
&2000
action%
0,1,8 : valid%=
&
2,3 : valid%=(window%=1)
: valid%=
valid%=(action%=0)
=valid%
setinstalled(f%)
installed%=f%
'" $(bariconname%)="!rpcbooted"
)" $(bariconname%)="frpcbooted"
seticonstate(-2,baricon%,0,0)
seticonstate(window%,icon%,eor%,clr%)
scrapblk%!0=window%
scrapblk%!4=icon%
scrapblk%!8=eor%
scrapblk%!12=clr%
"Wimp_SetIconState",,scrapblk%
selecticon(window%,icon%,f%)
scrapblk%!0=window%
scrapblk%!4=icon%
scrapblk%!8=1<<21
scrapblk%!8=0
scrapblk%!12=1<<21
"Wimp_SetIconState",,scrapblk%
menuselect(selection%)
adjust%,selinfo%,itemnr%,item%,item$,parentitem%,seq%,data%
"MenuUtil_Decode",lastmenu%,selection%
,adjust%,selinfo%
itemnr%=selinfo%!0
item%=selinfo%!8
item$=
str(selinfo%!12)
parentitem%=selinfo%!24
seq%=lastmenu_seq%
lastmenu_line%>=0
data%=appl%(seq%,lastmenu_line%)
item%
item_install%
installed%
dialogue(2)
O
dialogue(1)
Q
item_savechoices%
choices_save
item_quit%
U%
changed%(0)
changed%(1)
dialogue(3)
W
quit%=
Y
item_display0%,item_display1%
[
item%=item_display0%
display%(seq%)=0
]
display%(seq%)=1
_
seq_setextent(seq%)
openwindow(seq%,2)
redrawfromline(seq%,0)
item_openparent%
d(
openparent(seq%,lastmenu_line%)
item_off%
data%!292=
(data%!292)
g(
redrawline(seq%,lastmenu_line%)
seq_setchanged(seq%,
item_delete%
j&
appl_del(seq%,lastmenu_line%)
openwindow(seq%,3)
lastmenu_line%=-1
item_args%
$(data%+296)=item$
o(
redrawline(seq%,lastmenu_line%)
seq_setchanged(seq%,
item_toroot%
r% $(data%)=
striproot($(data%))
$(data%+256)="$"
t(
redrawline(seq%,lastmenu_line%)
item_saveseq%
seq_save(seq%)
item_reread%,item_rereadcver%
seq_clear(seq%)
y'
seq_load(seq%,
seqfname(seq%))
item_rereadpver%
seq_clear(seq%)
|6
seq_load(seq%,backupdir$+"."+seqfname$(seq%))
seq_setchanged(seq%,
adjust%
showmenu(0,lastmenu%,lastmenu_seq%,lastmenu_line%)
*** procs for creating menus ***
showmenu(blkptr%,menu%,seq%,linenr%)
item$,b%,dy%
dy%=22
menu%
mainmenu%
installed%
B
"MenuUtil_Text",item_install%,
msg_lookup0("IT_DEIN")
B
"MenuUtil_Text",item_install%,
msg_lookup0("IT_INST")
9
"MenuUtil_Fade",item_savechoices%,
installed%
seqmenu%
:
"MenuUtil_TickOnly",displaymenu%,display%(seq%)
* item$=
msg_lookup0("IT_ITEM")+" '"
-
linenr%>=nrapps%(seq%)
linenr%=-1
linenr%<0
+
"MenuUtil_Fade",itemsubmenu%,1
.
"MenuUtil_Colours",item_item%,2,0
+
"MenuUtil_Fade",itemsubmenu%,0
.
"MenuUtil_Colours",item_item%,7,0
b%=appl%(seq%,linenr%)
item$+=$(b%+256)
1
"MenuUtil_Text",item_args%,$(b%+296)
I
"MenuUtil_Fade",item_toroot%,(b%!268<>&1000)
($(b%+256)="$")
:
"MenuUtil_Tick",item_argsmenu%,
($(b%+296))>0
-
"MenuUtil_Tick",item_off%,b%!292
dy%+=44
item$+="'"
+
"MenuUtil_Text",item_item%,item$
A
"MenuUtil_Fade",item_rereadpver%,
backupexists%(seq%)
blkptr%<>0
blkptr%!4=blkptr%!4+dy%
lastmenu%=menu%
lastmenu_seq%=seq%
lastmenu_line%=linenr%
"MenuUtil_Show",lastmenu%,blkptr%
menu_add(text$,submenu%)
handle%
"MenuUtil_Add",,text$
handle%
submenu%<>-1
"MenuUtil_SubMenu",handle%,submenu%
=handle%
menu_addwritable(maxlen%,validstr%)
handle%
"MenuUtil_Add",,""
handle%
"MenuUtil_Writable",,1,maxlen%,validstr%
=handle%
initmenus
"MenuUtil_Initialise",010,0
"MenuUtil_New",,appl$
mainmenu%
:item_info%=
menu_add(
msg_lookup0("IT_INFO"),infowin%)
"item_install%=
menu_add("",-1)
;item_savechoices%=
menu_add(
msg_lookup0("IT_SVCH"),-1)
4item_quit%=
menu_add(
msg_lookup0("IT_QUIT"),-1)
"MenuUtil_New",,
msg_lookup0("IT_ARGS")
argsmenu%
&item_args%=
menu_addwritable(64,0)
"MenuUtil_New",,
msg_lookup0("IT_DISP")
displaymenu%
9item_display0%=
menu_add(
msg_lookup0("IT_DISP0"),-1)
9item_display1%=
menu_add(
msg_lookup0("IT_DISP1"),-1)
"MenuUtil_New",,
msg_lookup0("IT_ITEM")
itemsubmenu%
2item_off%=
menu_add(
msg_lookup0("IT_OFF"),-1)
?item_argsmenu%=
menu_add(
msg_lookup0("IT_ARGS"),argsmenu%)
"MenuUtil_Dots",0,1
:item_openparent%=
menu_add(
msg_lookup0("IT_OPAR"),-1)
6item_toroot%=
menu_add(
msg_lookup0("IT_ROOT"),-1)
5item_delete%=
menu_add(
msg_lookup0("IT_DEL"),-1)
"MenuUtil_New",,
msg_lookup0("IT_RERD")
rereadmenu%
:item_rereadcver%=
menu_add(
msg_lookup0("IT_CVER"),-1)
:item_rereadpver%=
menu_add(
msg_lookup0("IT_PVER"),-1)
"MenuUtil_New",,
msg_lookup0("IT_SEQ")
seqmenu%
Aitem_display%=
menu_add(
msg_lookup0("IT_DISP"),displaymenu%)
)item_item%=
menu_add("",itemsubmenu%)
7item_saveseq%=
menu_add(
msg_lookup0("IT_SVSQ"),-1)
?item_reread%=
menu_add(
msg_lookup0("IT_RERD"),rereadmenu%)
lastmenu%=0
*** procs for handling messages in the Messages file ***
msg_init
fname$,flags%,size%,buf%
fname$=ApplPath$+"Messages"
"MessageTrans_FileInfo",,fname$
flags%,,size%
flags%
buf%=0
buf% size%
MsgDesc% 17+
(fname$)
$(MsgDesc%+16)=fname$
"MessageTrans_OpenFile",MsgDesc%,MsgDesc%+16,buf%
msg_exit
"MessageTrans_CloseFile",MsgDesc%
MsgDesc%=0
msg_lookup0(token$)
result%
"MessageTrans_Lookup",MsgDesc%,token$,0
,,result%
str(result%)
msg_lookup1(token$,param$)
result%
"MessageTrans_Lookup",MsgDesc%,token$,scrapblk%,&100,param$
,,result%
str(result%)
dialogue(no%)
cancelbutton%,text1$,text2$,text3$,beep%
beep%=
no%
' $dial_msg%=
msg_lookup0("NRMI")
! text2$=
msg_lookup0("OK")
beep%=
0 $dial_msg%=
msg_lookup1("INSTALL",appl$)
# text1$=
msg_lookup0("INST")
# text3$=
msg_lookup0("CANC")
2 $dial_msg%=
msg_lookup1("DEINSTALL",appl$)
% text1$=
msg_lookup0("DEINST")
# text3$=
msg_lookup0("CANC")
' $dial_msg%=
msg_lookup0("QNYW")
# text1$=
msg_lookup0("QUIT")
# text3$=
msg_lookup0("CANC")
dialogue_setbutton(1,text1$)
dialogue_setbutton(2,text2$)
dialogue_setbutton(3,text3$)
beep%
scrapblk%!0=dialogwin%
"Wimp_GetWindowState",,scrapblk%
8xpos%=(screensize_x%-(scrapblk%!12-scrapblk%!4))
8ypos%=(screensize_y%+(scrapblk%!16-scrapblk%!8))
"Wimp_CreateMenu",,dialogwin%,xpos%,ypos%
lastdialogue%=no%
dialogue_setbutton(no%,text$)
mask%
mask%=(1<<2)+(&FF<<24)
text$=""
make button invisible
seticonstate(dialogwin%,no%,&11<<24,mask%)
$(dial_text%(no%))=text$
seticonstate(dialogwin%,no%,dial_buttoncol%,mask%)
heap_init
'>Heap%=
heap starts just after end of allocated memory
"OS_ReadMemMapInfo"
PageSize%
enlarge wimpslot (1 page) and create private heap in new memory
SlotSize%=Heap%-&8000
"Wimp_SlotSize",SlotSize%+PageSize%,-1
SlotSize%
HeapEnd%=SlotSize%+&8000
HeapEnd%<=Heap%
0,"Can't claim space for heap"
"OS_Heap",0,Heap%,,HeapEnd%-Heap%
heap_get(size%)
maxfree%,nrpages%,oldheapend%,ptr%
"OS_Heap",1,Heap%
,,maxfree%
size%>maxfree%
largest free block is too small - try to enlarge wimpslot and heap
6C nrpages%=1+(size%
PageSize%) :
required # pages of memory
"Wimp_SlotSize",SlotSize%+nrpages%*PageSize%,-1
SlotSize%
oldheapend%=HeapEnd%
HeapEnd%=SlotSize%+&8000
"OS_Heap",5,Heap%,,HeapEnd%-oldheapend%
"OS_Heap",1,Heap%
,,maxfree% :
do we have enough now?
size%>maxfree%
complain(
msg_lookup0("NOHP"))
ptr%=-1
"OS_Heap",2,Heap%,,size%
,,ptr%
C =ptr%
heap_release(ptr%)
maxfree%,nrpages%,flg%
"OS_Heap",3,Heap%,ptr%
"OS_Heap",1,Heap%
,,maxfree%
maxfree%>PageSize%
more than 1 page free - try to shrink heap (page by page)
K, nrpages%=0 :
# pages of memory freed
M1
"XOS_Heap",5,Heap%,,-PageSize%
;flg%
(flg%
1)=0
nrpages%+=1
P
(flg%
1)<>0
nrpages%>0
S4
successfully shrunk heap - shrink WimpSlot
TF
"Wimp_SlotSize",SlotSize%-nrpages%*PageSize%,-1
SlotSize%
U HeapEnd%=SlotSize%+&8000
"OS_Heap",5,Heap%,,(HeapEnd%-Heap%)-Heap%!12
choices_load
(ApplDir$+".Choices")
F%=0
choices_default
#F%,display%(0),display%(1)
#F%,winxmin%(0),winymin%(0),winxmax%(0),winymax%(0)
#F%,winxmin%(1),winymin%(1),winxmax%(1),winymax%(1)
choices_save
(ApplDir$+".Choices")
F%<>0
#F%,display%(0),display%(1)
scrapblk%!0=winhdl%(0)
"Wimp_GetWindowState",,scrapblk%
winxmin%(0)=scrapblk%!4
winymin%(0)=scrapblk%!8
winxmax%(0)=scrapblk%!12
winymax%(0)=scrapblk%!16
#F%,winxmin%(0),winymin%(0),winxmax%(0),winymax%(0)
scrapblk%!0=winhdl%(1)
"Wimp_GetWindowState",,scrapblk%
winxmin%(1)=scrapblk%!4
winymin%(1)=scrapblk%!8
winxmax%(1)=scrapblk%!12
winymax%(1)=scrapblk%!16
#F%,winxmin%(1),winymin%(1),winxmax%(1),winymax%(1)
choices_default
display%(0)=0
display%(1)=0
winxmin%(0)=2
winymin%(0)=824
winxmax%(0)=580
winymax%(0)=980
winxmin%(1)=660
winymin%(1)=824
winxmax%(1)=1238
winymax%(1)=980